/**
 * 开始界面
 * @returns {StartView}
 */
StartView = function()
{
	BaseView.call( this );
	this.className = "StartView";
	
	this.playBtn ;
};
FLASH.extend( StartView , BaseView);
//StartView.prototype = new BaseView();
//StartView.prototype.constructor = StartView ;

/**
 * 重写父类的方法
 */
StartView.prototype.init = function()
{
	//添加开始按钮
	this.playBtn = this.createPlayButton();
	this.playBtn.useHandCursor = true;
	//显示位置
	this.playBtn.setX(  (GameSetting.SCENE_WIDTH-this.playBtn.getWidth())>>1 );
	this.playBtn.setY( GameSetting.SCENE_HEIGHT -this.playBtn.getHeight() - 50 );
	this.addChild( this.playBtn);
	//对按钮添加点击侦听
	this.playBtn.addEventListener(MouseEvent.CLICK , this.playBtnHandler );
};


/**
 * 点击开始按钮
 * @param e
 */
StartView.prototype.playBtnHandler = function(e)
{
	var startView = e.getTarget().getParent() ;
	 e.getTarget().removeEventListener(MouseEvent.CLICK , startView.playBtnHandler );
	GlobalDispatcher.getInstance().dispatchEvent( new GlobalEvent(GlobalEvent.GAME_START));
};

/**
 * 创建开始按钮
 * @returns {SimpleButton}
 */
StartView.prototype.createPlayButton = function()
{
	var btnBmd = ResManager.getInstance().getBmdByName("play-bt-splash");
	var playBtn = new SimpleButton(btnBmd, btnBmd.getWidth() , (btnBmd.getHeight()/3>>0) );
	//设置按钮的状态
	playBtn.setUpRect( new Rectangle(0,0,playBtn.getWidth() , playBtn.getHeight() ));
	playBtn.setOverRect( new Rectangle(0,playBtn.getHeight(),playBtn.getWidth() , playBtn.getHeight() ));
	playBtn.setDownRect( new Rectangle(0,playBtn.getHeight()*2 , playBtn.getWidth() , playBtn.getHeight() ));
	
	return playBtn ;
};

/**
 * 重写父类的释放资源方法
 */
StartView.prototype.dispose = function()
{
	BaseView.prototype.dispose.call(this);
	this.playBtn = null ;
};